﻿@{
    ViewBag.Title = "CustIndex";
    Layout = "~/Views/Users/Index.cshtml";
}

<script src="~/Scripts/jquery-1.8.2.min.js"></script>
<link href="~/css/bootstrap.css" rel="stylesheet" />
<script src="~/js/bootstrap.min.js"></script>
<script src="~/js/jquery.min.js"></script>


<table class="table table-responsive">
    <tr>
        <td>编号</td>
        <td>用户名</td>
        <td>密码</td>
        <td>积分</td>
        <td>状态</td>
        <td>注册时间</td>
        <td>操作</td>
    </tr>
    @foreach (var i in ViewBag.list)
    {
        <tr>
            <td>@i.UserID</td>
            <td>@i.UserTel</td>
            <td>@i.UserPwd</td>
            <td>@i.UserIntegral</td>
            <td>@i.UserState</td>
            <td>@i.UserRegTime</td>
            <td><input type='button' value='冻结' class='btn btn-success' onclick='Del(@i.UserID)' /><input type='button' value='解冻' class='btn btn-success' onclick='Full(@i.UserID)' /></td>
        </tr>
    }
</table>

<script>
    function Full(id) {
        $.ajax({
            type: "post",
            url: "/Cust/CustFull",
            data: { UserID: id },

            success: function (obj) {
                if (obj > 0) {
                    alert("解冻成功");
                    location.href = '/Cust/CustIndex';
                }
                else {
                    alert("失败!");
                }
            }
        })
    }
    function Del(id) {

        $.ajax({
            type: "post",
            url: "/Cust/CustDel",
            data: { UserID: id },

            success: function (obj) {
                if (obj > 0) {
                    alert("冻结成功");
                    location.href = '/Cust/CustIndex';
                }
                else {
                    alert("失败!");
                }
            }
        })
    }
</script>